package com.bwie.controller;
import com.bwie.domain.Prod;
import com.bwie.dto.PageInfoVo;
import com.bwie.dto.ProdDto;
import com.bwie.dto.ProdFileDto;
import com.bwie.service.Impl.ProdServiceImpl;
import com.bwie.service.ProdFileService;
import com.bwie.service.ProdService;
import com.bwie.utils.R;
import io.swagger.annotations.ApiOperation;
import org.omg.CORBA.TRANSACTION_MODE;
import org.springframework.web.bind.annotation.*;

import org.springframework.beans.factory.annotation.Autowired;

/**
* 商品表(tb_prod)表控制层
*
* @author xxxxx
*/
@RestController
@RequestMapping("/good/prod")
public class ProdController {
/**
* 服务对象
*/
    @Autowired
    private ProdService prodService;

    @Autowired
    private ProdFileService prodFileService;

    @ApiOperation("保存商品")
    @PostMapping("saveProd")
    public R saveProd (@RequestBody ProdDto prodDto){
        return prodService.saveProd(prodDto);
    }

    /**
     * @description:获取分页商品信息
     * @author: Zero
     * @date: 2025/10/25 8:54
     * @param:
     * @return:
     **/
    @ApiOperation("商品分页")
    @PostMapping("selectProdList")
    public R selectProdList(@RequestBody PageInfoVo pageInfoVo){
        return prodService.selectProdList(pageInfoVo);
    }

    @ApiOperation("商品附件保存")
    @PostMapping("saveProdFile")
    public R saveProdFile(@RequestBody ProdFileDto prodFileDto){
        return prodFileService.saveProdFile(prodFileDto);
    }

    /**
     * @description: 从 es 中查询商品数据
     * @author: Zero
     * @date: 2025/10/30 18:30
     * @param:
     * @return:
     **/
    @ApiOperation("从 es 中查询商品数据")
    @PostMapping("selectProdListByEs")
    public R selectProdListByEs(@RequestBody PageInfoVo pageInfoVo){
        return prodService.selectProdListByEs(pageInfoVo);
    }


}
